package com.aconcagua.beans {
  [DefaultProperty("$valueHolder")]
  public class BeanMetadataSupport {
    public var $valueHolder:ValueHolder;

    public function BeanMetadataSupport(value: Object = null) {
      if (value is ValueHolder) {
        $valueHolder = value as ValueHolder;
      }
      else if (value is BeanDefinitionFactory) {
        $valueHolder = new Ref(value as BeanDefinitionFactory);
      } 
      else {
        $valueHolder = new Value(value);
      }
    }
    
    public function set value(aValue:Object): void {
      $valueHolder = new Value(aValue);
    }

    public function set ref(bean: BeanDefinitionFactory): void {
      $valueHolder = new Ref(bean);
    }
  }
}